package model

import (
	"gorm.io/gorm"
	"time"
)

type Video struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" form:"id" json:"id"`
	UserId    int32          `gorm:"column:user_id;type:int;comment:发布者;not null;" form:"userId" form:"user_id"`                  // 发布者
	ImageUrl  string         `gorm:"column:image_url;type:varchar(500);comment:封面地址;not null;" form:"imageUrl" json:"image_url"` // 封面地址
	VideoUrl  string         `gorm:"column:video_url;type:varchar(500);comment:视频地址;not null;" form:"videoUrl" json:"video_url"` // 视频地址
	LookNum   int32          `gorm:"column:look_num;type:int;comment:播放数;not null;" form:"lookNum" json:"look_num"`               // 播放数
	LikeNum   int32          `gorm:"column:like_num;type:int;comment:点赞数;not null;" form:"likeNum" json:"like_num"`               // 点赞数
	Title     string         `gorm:"column:title;type:varchar(40);comment:标题;not null;" form:"title" json:"title"`                 // 标题
	Info      string         `gorm:"column:info;type:varchar(60);comment:描述;not null;" form:"info" json:"info"`                    // 描述
	VideoTime time.Time      `gorm:"column:video_time;type:datetime;comment:时长;not null;" form:"videoTime" json:"video_time"`      // 时长
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"createdAt" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"updatedAt" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" form:"deletedAt" json:"deleted_at"`
}

func (v Video) TableName() string {
	return "video"
}
